'use strict';

module.exports = app => {
  const { model } = app;
  const { UUID, STRING, INTEGER } = app.Sequelize;

  const Comment = model.define(
    'Comment',
    {
      id: {
        type: INTEGER,
        primaryKey: true,
        autoIncrement: true,
      },
      topic_id: {
        type: UUID,
        allowNull: false,
        comment: '主题id',
      },
      topic_type: {
        type: INTEGER,
        allowNull: false,
        comment: '主题的类别 0 新闻',
      },
      content: {
        type: STRING(255),
        allowNull: true,
        comment: '评论内容',
      },
      from_userid: {
        type: UUID,
        allowNull: false,
        comment: '评论人id',
      },
    },
    {
      tableName: 'cms_comment',
    }
  );

  Comment.associate = function() {

  };

  return Comment;
};
